
#include "http.h"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(int argc, char **argv)
{
	unsigned char buffer[1024] = {0};

	pST_HTTP http = NULL;

	if(8 != argc)
	{
		return -1;
	}

	//http = http_init((unsigned char *)"admin.elitah.tk", 80, (unsigned char *)"/json/pptp_statistics.php");
	
	if(NULL != http)
	{
		if(0 == http->connect(http))
		{
			snprintf((char *)buffer, sizeof(buffer), "{\"ifdev\":\"%s\", \"pts\":\"%s\", \"rate\":%d, \"gw\":\"%s\", \"ip\":\"%s\", \"src\":\"%s\", \"username\":\"%s\"}", \
																argv[1], argv[2], atoi(argv[3]), argv[4], argv[5], argv[6], argv[7]);
			http->post_n(http, buffer, strlen((char *)buffer));
		}

		http->release(&http);
	}
	
	printf("OK\n");

	return 0;
}
